﻿using Microsoft.AspNet.SignalR;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Hosting;
using OfficeMiddlewareCore;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Office.Interop.Word;
using System.Diagnostics;

namespace Host.Test
{
    public class Program
    {
        static void Main(string[] args)
        {
            var file = @"D:\文档\WeChat Files\cc1027cc\FileStorage\File\2022-08\c311397593c5418dae08836822ebf180.DOC";
            var word = new Application();
            word.Documents.Open(file);
            word.Visible = true;
        }
    }

    public class Startup
    {
        public void Configuration(IAppBuilder appBuilder)
        {
            HttpConfiguration config = new HttpConfiguration();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "{controller}/{action}");


            appBuilder.UseCors(CorsOptions.AllowAll);

            appBuilder.MapSignalR();
            appBuilder.UseWebApi(config);
        }
    }

    public class TestController : ApiController
    {
        public string Get(string content)
        {
            return $"http返回消息:{content}";
        }
    }

    public class TestHub : Hub
    {
        public void Test(string content)
        {
            Clients.All.ReceiveMessage($"websocket返回消息:{content}");
        }

    }
}
